import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ParkOrderRefundVO, ParkOrderRefundForm, ParkOrderRefundQuery } from '@/api/park/parkOrderRefund/types';

/**
 * 查询订单退款列表
 * @param query
 * @returns {*}
 */

export const listParkOrderRefund = (query?: ParkOrderRefundQuery): AxiosPromise<ParkOrderRefundVO[]> => {
  return request({
    url: '/park/parkOrderRefund/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询订单退款详细
 * @param refundId
 */
export const getParkOrderRefund = (refundId: string | number): AxiosPromise<ParkOrderRefundVO> => {
  return request({
    url: '/park/parkOrderRefund/' + refundId,
    method: 'get'
  });
};

/**
 * 新增订单退款
 * @param data
 */
export const addParkOrderRefund = (data: ParkOrderRefundForm) => {
  return request({
    url: '/park/parkOrderRefund',
    method: 'post',
    data: data
  });
};

/**
 * 修改订单退款
 * @param data
 */
export const updateParkOrderRefund = (data: ParkOrderRefundForm) => {
  return request({
    url: '/park/parkOrderRefund',
    method: 'put',
    data: data
  });
};

/**
 * 删除订单退款
 * @param refundId
 */
export const delParkOrderRefund = (refundId: string | number | Array<string | number>) => {
  return request({
    url: '/park/parkOrderRefund/' + refundId,
    method: 'delete'
  });
};
